package com.yzp.dao;

import com.yzp.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @title: UserMapper
 * @Author: yzp
 * @Date: 2019/7/22 16:47
 * @Version 1.0
 */
public interface UserDao extends JpaRepository<User, Long>, JpaSpecificationExecutor<User> {

    //SQL
    //JPQL
    User findByUsername(String name);

    //JPQL
    @Query("from User where id=?2 or username = ?1")
    List<User> findJPQL(String name, Long id);
}
